Hệ thống quản lý phòng khám trực tuyến bằng PHP
1 <!-- Edit this file to change the layout of the detail view form -->
2
3 <script src="resources/datepicker/js/datepicker.packed.js"></script>
4 <link href="resources/datepicker/css/datepicker.css" rel="stylesheet">
5
6 <a name="detail-view"></a>
7 <div class="panel-heading"><h3 class="panel-title"><strong><%%DETAIL_VIEW_TITLE%%></strong></h3></div>
8
9 <div class="panel-body" id="patients_dv_container">
10 <!-- child links -->
11 <div class="row">
12 <div class="col-xs-12">
13 <a class="hidden-xs btn btn-default btn-lg pull-right hidden hspacer-sm" href="medical_records_view.php?filterer_patient=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="medical_records_link"><i class="glyphicon glyphicon-list-alt"></i> Medical Records</a>
14 <a class="visible-xs btn btn-default btn-lg btn-block hidden vspacer-sm" href="medical_records_view.php?filterer_patient=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>" id="xs_medical_records_link"><i class="glyphicon glyphicon-list-alt"></i> Medical Records</a>
15 <input type="hidden" id="medical_records_hclink" value="medical_records_view.php?filterer_patient=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
16 <input type="hidden" id="events_hclink" value="events_view.php?filterer_name_patient=<%%URLVALUE(id)%%>&<%%EMBEDDED%%>">
17 <div class="clearfix"></div>
18 </div>
19 </div>
20 <hr>
21
22 <div class="row">
23 <!-- form inputs -->
24 <div class="col-md-8 col-lg-10" id="patients_dv_form">
25 <fieldset class="form-horizontal">
26
27 <div class="form-group">
28 <label for="id" class="control-label col-lg-3">ID</label>
29 <div class="col-lg-9">
30 <div class="form-control-static" id="id"><%%VALUE(id)%%></div>
31 </div>
32 </div>
33
34 <div class="form-group">
35 <label for="last_name" class="control-label col-lg-3">Last name<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
36 <div class="col-lg-9">
37 <input maxlength="40" type="text" class="form-control" name="last_name" id="last_name" value="<%%VALUE(last_name)%%>" required>
38 </div>
39 </div>
40
41 <div class="form-group">
42 <label for="first_name" class="control-label col-lg-3">First name<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
43 <div class="col-lg-9">
44 <input maxlength="40" type="text" class="form-control" name="first_name" id="first_name" value="<%%VALUE(first_name)%%>" required>
45 </div>
46 </div>
47
48 <div class="form-group">
49 <label for="gender" class="control-label col-lg-3">Gender<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
50 <div class="col-lg-9">
51 <%%COMBO(gender)%%>
52 </div>
53 </div>
54
55 <div class="form-group">
56 <label for="sexual_orientation" class="control-label col-lg-3">Sexual orientation<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
57 <div class="col-lg-9">
58 <%%COMBO(sexual_orientation)%%>
59 </div>
60 </div>
61
62 <div class="form-group">
63 <label for="birth_date" class="control-label col-lg-3">Birth date</label>
64 <div class="col-lg-9">
65 <%%COMBO(birth_date)%%>
66 </div>
67 </div>
68
69 <div class="form-group">
70 <label for="age" class="control-label col-lg-3">Age <i class="glyphicon glyphicon-info-sign text-info" data-toggle="collapse" data-target="#age-description"></i></label>
71 <div class="col-lg-9">
72 <span class="help-block collapse" id="age-description"><div class="alert alert-info">Automatically calculated from birth date.</div></span>
73
74 <div class="form-control-static" id="age"><%%VALUE(age)%%></div>
75 </div>
76 </div>
77
78 <div class="form-group">
79 <label class="control-label col-lg-3">Image <i class="glyphicon glyphicon-info-sign text-info" data-toggle="collapse" data-target="#image-description"></i></label>
80 <div class="col-lg-9">
81 <span class="help-block collapse" id="image-description"><div class="alert alert-info">Maximum file size allowed: 1000 KB.<br>Allowed file types: jpg, jpeg, gif, png</div></span>
82
83 <div class="form-control-static"><div class="pull-left">
84
85 <a href="<%%TRANSLATION(ImageFolder)%%><%%VALUE(image)%%>" data-lightbox="patients_dv"><img src="thumbnail.php?i=<%%VALUE(image)%%>&t=patients&f=image&v=dv" class="img-thumbnail" id="image-image"></a>
86 </div>
87
88 <div class="pull-right" style="overflow-x: hidden;">
89 <div class="hidden-md hidden-lg vspacer-lg"></div>
90 <%%UPLOADFILE(image)%%>
91 <%%REMOVEFILE(image)%%>
92 </div>
93 <div class="clearfix"></div>
94 </div>
95
96 </div>
97 </div>
98
99 <div class="form-group">
100 <label for="state" class="control-label col-lg-3">State</label>
101 <div class="col-lg-9">
102 <%%COMBO(state)%%>
103 </div>
104 </div>
105
106 <div class="form-group">
107 <label for="mobile" class="control-label col-lg-3">Mobile</label>
108 <div class="col-lg-9">
109 <input maxlength="40" type="text" class="form-control" name="mobile" id="mobile" value="<%%VALUE(mobile)%%>">
110 </div>
111 </div>
112
113 <div class="form-group">
114 <label for="tobacco_usage" class="control-label col-lg-3">Tobacco usage<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
115 <div class="col-lg-9">
116 <%%COMBO(tobacco_usage)%%>
117 </div>
118 </div>
119
120 <div class="form-group">
121 <label for="alcohol_intake" class="control-label col-lg-3">Alcohol Intake<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
122 <div class="col-lg-9">
123 <%%COMBO(alcohol_intake)%%>
124 </div>
125 </div>
126
127 <div class="form-group">
128 <label for="history" class="control-label col-lg-3">History<span class="text-danger"><%%TRANSLATION(*)%%></span></label>
129 <div class="col-lg-9">
130 <%%COMBO(history)%%>
131 </div>
132 </div>
133
134 <div class="form-group">
135 <label for="surgical_history" class="control-label col-lg-3">Surgical history</label>
136 <div class="col-lg-9">
137 <textarea class="form-control" name="surgical_history" id="surgical_history" rows="5"><%%VALUE(surgical_history)%%></textarea>
138 </div>
139 </div>
140
141 <div class="form-group">
142 <label for="obstetric_history" class="control-label col-lg-3">Obstetric history</label>
143 <div class="col-lg-9">
144 <textarea class="form-control" name="obstetric_history" id="obstetric_history" rows="5"><%%VALUE(obstetric_history)%%></textarea>
145 </div>
146 </div>
147
148 <div class="form-group">
149 <label for="genetic_diseases" class="control-label col-lg-3">Genetic diseases</label>
150 <div class="col-lg-9">
151 <textarea class="form-control" name="genetic_diseases" id="genetic_diseases" rows="5"><%%VALUE(genetic_diseases)%%></textarea>
152 </div>
153 </div>
154
155 <div class="form-group">
156 <label for="contact_person" class="control-label col-lg-3">Contact person in case of Emergency</label>
157 <div class="col-lg-9">
158 <input maxlength="100" type="text" class="form-control" name="contact_person" id="contact_person" value="<%%VALUE(contact_person)%%>">
159 </div>
160 </div>
161
162 <div class="form-group">
163 <label for="other_details" class="control-label col-lg-3">Other details</label>
164 <div class="col-lg-9">
165 <textarea class="form-control" name="other_details" id="other_details" rows="5"><%%VALUE(other_details)%%></textarea>
166 </div>
167 </div>
168
169 <div class="form-group">
170 <label for="comments" class="control-label col-lg-3">Comments</label>
171 <div class="col-lg-9">
172 <%%HTMLAREA(comments)%%>
173 </div>
174 </div>
175
176 <div class="form-group">
177 <label for="filed" class="control-label col-lg-3">Filed <i class="glyphicon glyphicon-info-sign text-info" data-toggle="collapse" data-target="#filed-description"></i></label>
178 <div class="col-lg-9">
179 <span class="help-block collapse" id="filed-description"><div class="alert alert-info">This field is automatically populated with the date and time when this record was created.</div></span>
180
181 <div class="form-control-static" id="filed"><%%VALUE(filed)%%></div>
182 </div>
183 </div>
184
185 <div class="form-group">
186 <label for="last_modified" class="control-label col-lg-3">Last modified <i class="glyphicon glyphicon-info-sign text-info" data-toggle="collapse" data-target="#last_modified-description"></i></label>
187 <div class="col-lg-9">
188 <span class="help-block collapse" id="last_modified-description"><div class="alert alert-info">This field is automatically populated with the date and time when this record was last modified.</div></span>
189
190 <div class="form-control-static" id="last_modified"><%%VALUE(last_modified)%%></div>
191 </div>
192 </div>
193
194 </fieldset>
195 </div>
196
197 <!-- DV action buttons -->
198 <div class="col-md-4 col-lg-2" id="patients_dv_action_buttons">
199 <div class="btn-toolbar">
200 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
201 <%%UPDATE_BUTTON%%>
202 </div><p></p>
203 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
204 <%%DESELECT_BUTTON%%>
205 <%%DVPRINT_BUTTON%%>
206 <%%DELETE_BUTTON%%>
207 </div><p></p>
208 <div class="btn-group-vertical btn-group-lg" style="width: 100%;">
209 <%%INSERT_BUTTON%%>
210 </div>
211 </div>
212 </div>
213 </div>
214
215
216 <!-- child records -->
217 <hr>
218 <div class="row">
219 <div class="col-lg-10 col-lg-offset-1">
220 <div id="patients-children" class="children-tabs"></div>
221 </div>
222 </div>
223
224 </div><!-- /div class="panel-body" -->
225 <script src="nicEdit.js"></script>
226 <script>
227 $j(function() {
228 var add_new_mode = (!$j('input[name=SelectedID]').val());
229 var embedded_mode = ($j('input[name=Embedded]').val() == 1);
230
231 /* auto-close embedded page? */
232 var autoclose_mode = ($j('input[name=AutoClose]').val() == 1);
233 var record_added_ok = (location.search.split('record-added-ok=').length == 2);
234 var record_updated_ok = (location.search.split('record-updated-ok=').length == 2);
235 if((record_added_ok || record_updated_ok) && embedded_mode && autoclose_mode){
236 setTimeout(function(){
237 window.parent.jQuery('.modal').modal('hide');
238 }, 2000);
239 }
240
241 bkLib.onDomLoaded(function(){
242 if($j('textarea#comments').length) new nicEditor({ fullPanel : true }).panelInstance('comments');
243
244 $j('.nicEdit-panelContain').parent().width('90%');
245 $j('.nicEdit-panelContain').parent().next().width('88%');
246 $j('.nicEdit-main').width('99%');
247 });
248 /* enable DV action buttons to float on scrolling down the form */
249 enable_dvab_floating();
250
251 $j('select, input[type=text], textarea').not(':disabled').eq(0).focus();
252 $j('form').eq(0).change(function(){
253 if($j(this).data('already_changed')) return;
254 if($j('#deselect').length) $j('#deselect').removeClass('btn-default').addClass('btn-warning').get(0).lastChild.data = " <%%TRANSLATION(Cancel)%%>";
255 $j(this).data('already_changed', true);
256 });
257
258 $j('a[href="<%%TRANSLATION(ImageFolder)%%>"]').click(function(){ return false; });
259
260 if(embedded_mode){
261 /* hide links to children tables in embedded mode */
262 $j('.detail_view a[id$=_link]').remove();
263
264 /* append embedded mode to all links */
265 var append_embedded = function(){
266 $j('a[href]:not([href^=#]):not([href^=javascript]):not([href$="Embedded=1"]):not([href*="link.php?t="]):not([href^="mailto:"])').each(
267 function(){
268 $j(this).attr('href', $j(this).attr('href') + '&Embedded=1');
269 }
270 );
271 }
272 setTimeout(append_embedded, 500);
273 setTimeout(append_embedded, 1500);
274 setTimeout(append_embedded, 2500);
275 setTimeout(append_embedded, 3500);
276 }
277
278 /* when no record is selected ('add new' mode) */
279 if(add_new_mode){
280 /* hide links to children tables */
281 $j('.detail_view a[id$=_link]').remove();
282 }else{
283 post(
284 'parent-children.php', {
285 ParentTable: 'patients',
286 SelectedID: '<%%VALUE(id)%%>',
287 Operation: 'show-children'
288 },
289 'patients-children'
290 );
291 }
292
293 if(!embedded_mode){
294 /* add a horizontal spacer to [add new parent] buttons that don't have a spacered element before them */
295 $j('.add_new_parent').prev(':not(.hspacer-md)').next().addClass('hspacer-md');
296
297 $j('.add_new_parent').click(function(){
298 var pt = $j(this).attr('id').replace(/_add_new$/, '');
299 modal_window({
300 url: pt + '_view.php?addNew_x=1&Embedded=1',
301 close: function(){
302 var field_id = $j('#' + pt + '_add_new').prevAll('input:hidden').eq(0).attr('id');
303 $j('#' + field_id + '-container').select2('focus').select2('focus');
304 },
305 size: 'full',
306 title: $j(this).attr('title')
307 });
308 });
309 }
310
311 /* find and hide parent links if field label has data 'parent_link' set to 'view_parent_hidden' */
312 $j('label[data-parent_link=view_parent_hidden]').each(function(){
313 $j(this).parents('.form-group').find('.view_parent').hide();
314 });
315
316 $j('form').on('click', '.view_parent', function(){
317 var pt = $j(this).attr('id').replace(/_view_parent$/, '');
318 if($j(this).prevAll('input:hidden').length){
319 var parent_id = $j(this).prevAll('input:hidden').eq(0).val();
320 }else{
321 var parent_id = $j(this).prevAll().children('input:hidden').eq(0).val();
322 }
323
324 /* handle radio lookups */
325 if($j(this).prevAll('[type=radio]').length){
326 parent_id = $j(this).prevAll('[type=radio]').eq(0).val();
327 }
328
329 if(parent_id != '{empty_value}'){
330 var parent_link = $j(this).parents('.form-group').children('label').data('parent_link');
331 switch(parent_link){
332 case 'view_parent_hidden':
333 break;
334 case 'view_parent_modal':
335 modal_window({
336 url: pt + '_view.php?Embedded=1&SelectedID=' + encodeURIComponent(parent_id),
337 close: function(){
338 var field_id = $j('#' + pt + '_view_parent').prevAll('input:hidden').eq(0).attr('id');
339 $j('#' + field_id + '-container').select2('focus').select2('focus');
340 },
341 size: 'full',
342 title: $j(this).attr('title')
343 });
344 break;
345 case 'view_parent_same_window':
346 window.location = pt + '_view.php?Embedded=' + (embedded_mode ? '1' : '') + '&SelectedID=' + encodeURIComponent(parent_id);
347 break;
348 case 'view_parent_new_window':
349 window.open(pt + '_view.php?SelectedID=' + encodeURIComponent(parent_id));
350 break;
351 }
352
353 }
354 });
355
356
357 /* load admin tools for admin user */
358 if(!add_new_mode){
359 $j('body').append('<div id="admin-tools-appendix"></div>');
360 $j('#admin-tools-appendix').load(
361 'ajax_admin_tools.php?table=patients&id=<%%URLVALUE(id)%%>',
362 function(resp){
363 if(!resp.length) return;
364 $j.ajax('ajax_admin_tools.php?action=get_admin_tools_js&table=patients&id=<%%URLVALUE(id)%%>');
365 }
366 );
367 }
368
369 /* warn user if 'add new' clicked while unsaved changes exist */
370 $j('#addNew').click(function(){
371 if($j('#deselect.btn-warning').length){
372 return confirm('<%%TRANSLATION(discard changes confirm)%%>');
373 }
374 });
375
376 });
377 </script>